// models/Permission.js
const pool = require('../db');

class Permission {
  static async findByPk(id) {
    const [rows] = await pool.query('SELECT * FROM Permissions WHERE id = ?', [id]);
    return rows[0];
  }

  static async create(permission) {
    const [result] = await pool.query('INSERT INTO Permissions (name, description) VALUES (?, ?)', [permission.name, permission.description]);
    return result.insertId;
  }
}

module.exports = Permission;